package cn.donting.jme.expansion.attribute.lmpl;

import cn.donting.jme.expansion.attribute.Attribute;
import cn.donting.jme.expansion.attribute.ValueChangeListener;
import cn.donting.jme.swing.JFloatTextField;
import cn.donting.jme.swing.JIntegerTextField;
import cn.donting.jme.swing.JVector3fTextField;
import cn.donting.jme.swing.layout.HorizontalAutoLayout;
import com.jme3.math.Vector3f;
import lombok.extern.slf4j.Slf4j;
import org.jdesktop.swingx.VerticalLayout;

import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.*;
import java.math.BigDecimal;

@Slf4j
public class Vector3fAttribute extends AbsMuiltLineAttribute<Vector3f,JVector3fTextField> {

    public Vector3fAttribute(String title) {
        this();
        setTitle(title);
    }

    public Vector3fAttribute() {
        super(new JVector3fTextField());
        inputComponent.addValueChangeListener(this::change);
    }

    @Override
    public void setValue(Vector3f value) {
       inputComponent.setValue(value);
    }

    private void change(Vector3f newValue) {
        valueChange(newValue);
    }

    @Override
    protected Vector3f getInputValue() {
        return inputComponent.getValue();
    }
}
